package de.tmahr.android;

import de.tmahr.android.logger.LogActivity;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.preference.PreferenceManager;

public class SharedPreferenceTest extends LogActivity
{
	private String text;
	private int wert;
	
	public SharedPreferenceTest()
	{
		super("SharedPreferenceTest");
	}

	@Override
	public void onCreate(Bundle b)
	{
		super.onCreate(b);

		SharedPreferences p = PreferenceManager
				.getDefaultSharedPreferences(this);

		text = p.getString("keyText", "");
		wert = p.getInt("keyWert", 0);

		log("wert=" + wert + ", text=" + text);

		text += "A";
		wert++;
		
		Editor editor = p.edit();
		editor.putString("keyText", text);
		editor.putInt("keyWert", wert);
		editor.commit();
	}
}
